/*
 Navicat Premium Data Transfer

 Source Server         : localhost_3306
 Source Server Type    : MySQL
 Source Server Version : 80300
 Source Host           : localhost:3306
 Source Schema         : ggblog

 Target Server Type    : MySQL
 Target Server Version : 80300
 File Encoding         : 65001

 Date: 28/05/2024 15:25:30
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for fy_article
-- ----------------------------
DROP TABLE IF EXISTS `fy_article`;
CREATE TABLE `fy_article` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文章标题',
  `content` varchar(10000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文章内容',
  `type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '2' COMMENT '文章类型：1 文章 2 草稿',
  `summary` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文章摘要',
  `category_id` bigint DEFAULT NULL COMMENT '所属分类id',
  `thumbnail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '缩略图',
  `is_top` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否置顶：0否 1是',
  `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '1' COMMENT '文章状态：0已发布 1草稿',
  `comment_count` int DEFAULT '0' COMMENT '评论数',
  `view_count` bigint DEFAULT '0' COMMENT '访问量',
  `is_comment` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否允许评论：0否 1是',
  `create_by` bigint DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` bigint DEFAULT NULL COMMENT '更新人id',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否删除：0未删除 1已删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of fy_article
-- ----------------------------
BEGIN;
INSERT INTO `fy_article` VALUES (1, 'Spring从入门到精通', 'Spring入门', '1', 'spring入门', 1, NULL, '0', '0', 0, 100, '1', 1, '2024-02-25 20:20:11', NULL, '2024-05-22 09:20:01', '0');
INSERT INTO `fy_article` VALUES (2, 'Java从入门到精通', 'Java入门', '1', 'Java入门', 1, NULL, '0', '0', 0, 100, '1', 1, '2024-02-25 20:20:11', NULL, '2024-05-22 09:20:01', '0');
INSERT INTO `fy_article` VALUES (3, 'PHP从入门到精通', 'PHP入门', '1', 'PHP入门', 2, NULL, '0', '0', 0, 100, '1', 1, '2024-02-25 20:20:11', NULL, '2024-05-22 09:20:01', '0');
COMMIT;

-- ----------------------------
-- Table structure for fy_category
-- ----------------------------
DROP TABLE IF EXISTS `fy_category`;
CREATE TABLE `fy_category` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '分类名',
  `pid` bigint DEFAULT '-1' COMMENT '父分类id，如果没有父分类则为-1',
  `description` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述',
  `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '状态：0 正常，1禁用',
  `create_by` bigint DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` bigint DEFAULT NULL COMMENT '更新人id',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否删除：0未删除 1已删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of fy_category
-- ----------------------------
BEGIN;
INSERT INTO `fy_category` VALUES (1, 'java', -1, 'java', '0', 1, '2024-02-25 20:20:11', 1, '2024-02-25 20:20:11', '0');
INSERT INTO `fy_category` VALUES (2, 'iOS', -1, 'iOS', '0', 1, '2024-02-25 20:20:11', 1, '2024-02-25 20:20:11', '0');
COMMIT;

-- ----------------------------
-- Table structure for fy_comment
-- ----------------------------
DROP TABLE IF EXISTS `fy_comment`;
CREATE TABLE `fy_comment` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '评论类型 0 文章评论 1 友链评论',
  `article_id` bigint DEFAULT NULL COMMENT '文章id',
  `root_id` bigint DEFAULT '-1' COMMENT '根评论id',
  `content` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '评论内容',
  `to_comment_user_id` bigint DEFAULT '-1' COMMENT '回复的目标评论人的userid，比如xx回复了枫叶，这里指的就是枫叶的userid',
  `to_comment_id` bigint DEFAULT '-1' COMMENT '回复的目标评论的id',
  `create_by` bigint DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` bigint DEFAULT NULL COMMENT '更新人id',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否删除：0未删除 1已删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of fy_comment
-- ----------------------------
BEGIN;
INSERT INTO `fy_comment` VALUES (1, '0', 1, -1, '你说的对', -1, -1, 1, '2024-02-29 00:20:11', 1, '2024-02-29 00:20:11', '0');
INSERT INTO `fy_comment` VALUES (6, '0', 1, 1, '你让我说你什么好呢', 1, 1, 1, '2024-03-01 00:03:36', 1, '2024-03-01 00:03:36', '0');
INSERT INTO `fy_comment` VALUES (7, '0', 1, 1, '111', 1, 1, 1, '2024-03-01 00:27:34', 1, '2024-03-01 00:27:34', '0');
INSERT INTO `fy_comment` VALUES (8, '0', 1, -1, '文章写得不错', -1, -1, 1, '2024-03-01 00:28:03', 1, '2024-03-01 00:28:03', '0');
INSERT INTO `fy_comment` VALUES (11, '0', 1, 8, '谢谢', 1, 8, 1, '2024-03-01 00:28:03', 1, '2024-03-01 00:28:03', '0');
INSERT INTO `fy_comment` VALUES (12, '0', 1, 8, 'xiexie', 1, 8, 1, '2024-03-01 00:54:59', 1, '2024-03-01 00:54:59', '0');
INSERT INTO `fy_comment` VALUES (13, '0', 1, 1, '1123', 1, 7, 1, '2024-03-01 00:58:07', 1, '2024-03-01 00:58:07', '0');
COMMIT;

-- ----------------------------
-- Table structure for fy_file
-- ----------------------------
DROP TABLE IF EXISTS `fy_file`;
CREATE TABLE `fy_file` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '文件名称',
  `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '文件类型',
  `size` bigint DEFAULT NULL COMMENT '文件大小(kb)',
  `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '下载链接',
  `md5` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '文件md5',
  `enable` tinyint(1) DEFAULT '1' COMMENT '是否禁用链接',
  `create_by` bigint DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` bigint DEFAULT NULL COMMENT '更新人id',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否删除：0未删除 1已删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of fy_file
-- ----------------------------
BEGIN;
INSERT INTO `fy_file` VALUES (23, '项目运维流程图.png', 'png', 782, 'http://localhost:8089/uploads/cac95ff1-04ee-40b3-8463-a910eef5f407.png', 'a143eff800a49afc4c6bcc1b4817734a', 1, NULL, '2024-05-28 11:45:21', NULL, '2024-05-28 11:45:21', NULL);
INSERT INTO `fy_file` VALUES (24, '111.png', 'png', 149, 'http://localhost:8089/uploads/80c94889-6270-479b-b0df-24e2f2284ce6.png', '5eb775a0228b924425bb6ce125060d11', 1, NULL, '2024-05-28 14:18:31', NULL, '2024-05-28 14:18:31', NULL);
COMMIT;

-- ----------------------------
-- Table structure for fy_user
-- ----------------------------
DROP TABLE IF EXISTS `fy_user`;
CREATE TABLE `fy_user` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `username` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '用户名',
  `nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '昵称',
  `password` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '密码',
  `email` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '电子邮箱',
  `phone` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '电话号码',
  `type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '用户类型：0 普通用户 1管理员用户',
  `status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '账户状态：0 正常 1停用',
  `sex` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '性别：0-女，1-男，2-未知',
  `avatar` varchar(128) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT '头像',
  `create_by` bigint DEFAULT NULL COMMENT '创建人id',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` bigint DEFAULT NULL COMMENT '更新人id',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否删除：0未删除 1已删除',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `id_index` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
-- Records of fy_user
-- ----------------------------
BEGIN;
INSERT INTO `fy_user` VALUES (1, 'fengye', '枫叶', '$2a$10$QVTXBB8p//TzuZUQTR3fN.5memK8D9gRq8bOnL3hofuHtTxdwTisC', 'fengye@gg.com', '15201051230', '0', '0', '1', 'https://www.baidu.com/avaasdf.jpg', -1, '2024-02-25 02:42:07', -1, '2024-02-25 02:42:07', '0');
INSERT INTO `fy_user` VALUES (2, 'fengye1', '枫叶1', '$2a$10$UhqZzgULxaBOiz0.YuQhcuFYs0akFXvInfeFNd7S3btpuNcmzWhiG', 'fengye1@qq.com', '15201051237', '0', '0', '1', 'https://www.baidu.com', -1, '2024-02-29 23:15:30', -1, '2024-02-29 23:15:30', '0');
INSERT INTO `fy_user` VALUES (3, 'fengye2', '枫叶2', '$2a$10$X7h8Ud1UXVkc1V7rlJThCeyUOS.oHoxA0OC0gvQqSZhNkhj7MnR5G', 'fengye1@qq.com', '15201051237', '0', '0', '1', 'https://www.baidu.com', -1, '2024-02-29 23:17:58', -1, '2024-02-29 23:17:58', '0');
INSERT INTO `fy_user` VALUES (4, 'fengye3', '枫叶3', '$2a$10$YD7/xwFkXVObp4uuS90HuuxTGnox.N1mUGOx1EJcWWwXrT9EFzmHy', 'fengye1@qq.com', '15201051237', '0', '0', '1', 'https://www.baidu.com', -1, '2024-02-29 23:18:05', -1, '2024-02-29 23:18:05', '0');
INSERT INTO `fy_user` VALUES (5, 'fengye4', '枫叶4', '$2a$10$3t5d3ngJy6fnhTKpcuxJceyeUX2i2v5FCJlO8vNjrGPga/KHqNXtO', 'fengye1@qq.com', '15201051237', '0', '0', '0', 'https://www.baidu.com', -1, '2024-02-29 23:18:17', -1, '2024-02-29 23:18:17', '0');
INSERT INTO `fy_user` VALUES (6, 'fengye5', '枫叶5', '$2a$10$CC1JTRvnGukBjcMWaE0pI.gV39SohsJFGGxp.IzjBojSgGa0uvbBS', 'fengye1@qq.com', '15201051237', '0', '0', '0', 'https://www.baidu.com', -1, '2024-02-29 23:18:25', -1, '2024-02-29 23:18:25', '0');
COMMIT;

-- ----------------------------
-- View structure for top10
-- ----------------------------
DROP VIEW IF EXISTS `top10`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `top10` AS select `fy_user`.`id` AS `id`,`fy_user`.`username` AS `username`,`fy_user`.`nickname` AS `nickname`,`fy_user`.`password` AS `password`,`fy_user`.`email` AS `email`,`fy_user`.`phone` AS `phone`,`fy_user`.`type` AS `type`,`fy_user`.`status` AS `status`,`fy_user`.`sex` AS `sex`,`fy_user`.`avatar` AS `avatar`,`fy_user`.`create_by` AS `create_by`,`fy_user`.`create_time` AS `create_time`,`fy_user`.`update_by` AS `update_by`,`fy_user`.`update_time` AS `update_time`,`fy_user`.`del_flag` AS `del_flag` from `fy_user` where (`fy_user`.`id` > 2);

SET FOREIGN_KEY_CHECKS = 1;
